﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace AutoClicker
{
    public partial class AboutForm : Form
    {
        public AboutForm()
        {
            // 移除InitializeComponent调用，改为直接初始化

            this.Text = "关于鼠标自动点击器";
            this.Size = new Size(500, 450);
            this.StartPosition = FormStartPosition.CenterParent;
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;

            InitializeControls();
        }

        private void InitializeControls()
        {
            Panel mainPanel = new Panel
            {
                Dock = DockStyle.Fill,
                AutoScroll = true,
                Padding = new Padding(20)
            };
            this.Controls.Add(mainPanel);

            // 图标和标题
            PictureBox iconBox = new PictureBox
            {
                Image = SystemIcons.Information.ToBitmap(),
                SizeMode = PictureBoxSizeMode.Zoom,
                Size = new Size(64, 64),
                Location = new Point(20, 20)
            };

            Label titleLabel = new Label
            {
                Text = "鼠标自动点击器",
                Font = new Font("Microsoft YaHei", 16, FontStyle.Bold),
                AutoSize = true,
                Location = new Point(100, 30)
            };

            Label versionLabel = new Label
            {
                Text = "版本: 1.0.0",
                AutoSize = true,
                Location = new Point(100, 70)
            };

            // 分隔线
            Label separator = new Label
            {
                BorderStyle = BorderStyle.Fixed3D,
                Height = 2,
                Width = mainPanel.Width - 40,
                Location = new Point(20, 110)
            };

            // 关于信息
            Label aboutLabel = new Label
            {
                Text = @"鼠标自动点击器是一款简单易用的自动化工具，可以录制和回放鼠标动作，提高工作效率。

主要功能:
- 录制鼠标移动和点击
- 回放录制的动作序列
- 支持快捷键操作(F6-F9)
- 脚本保存和加载(.acs文件)
- 可调节回放速度",
                AutoSize = true,
                Location = new Point(20, 130),
                MaximumSize = new Size(450, 0)
            };

            // 开发者信息
            Label devLabel = new Label
            {
                Text = @"开发者信息:

唐润辉 - 项目负责人 & 首席开发工程师
联系方式: 381501630@qq.com
网址：www.zixinwang.com
",
                AutoSize = true,
                Location = new Point(20, 260),
                MaximumSize = new Size(450, 0),
                ForeColor = Color.Blue,
                Cursor = Cursors.Hand
            };
            devLabel.Click += (sender, e) =>
            {
                try
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("http://www.zixinwang.com")
                    {
                        UseShellExecute = true
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("无法启动浏览器: " + ex.Message);
                }
            };

            // 版权信息
            Label copyrightLabel = new Label
            {
                Text = "© 2023 鼠标自动点击器开发团队 - 保留所有权利",
                AutoSize = true,
                Location = new Point(20, 360)
            };

            // 确定按钮
            Button okButton = new Button
            {
                Text = "确定",
                DialogResult = DialogResult.OK,
                Size = new Size(80, 30),
                Location = new Point(mainPanel.Width - 100, 380)
            };

            // 添加控件到面板
            mainPanel.Controls.Add(iconBox);
            mainPanel.Controls.Add(titleLabel);
            mainPanel.Controls.Add(versionLabel);
            mainPanel.Controls.Add(separator);
            mainPanel.Controls.Add(aboutLabel);
            mainPanel.Controls.Add(devLabel);
            mainPanel.Controls.Add(copyrightLabel);
            mainPanel.Controls.Add(okButton);
        }

        private void InitializeComponent()
        {

        }
    }
}